System for accurately determining an amount of electrical current flowing through a hall effect current sensor

ABSTRACT

A system for accurately determining an amount of electrical current flowing through a Hall effect current sensor is provided. The system includes a microcontroller that determines a smoothed electrical current offset value based on an average measured apparent electrical current value, an electrical current offset smoothing coefficient, a prior smoothed electrical current offset value, and a prior electrical current offset trend value. The microcontroller determines an electrical current offset trend value associated with the Hall effect current sensor based on the smoothed electrical current offset value, an electrical current offset trend smoothing coefficient, a prior smoothed electrical current offset value, and the prior electrical current offset trend value.

BACKGROUND

The inventor herein has recognized a need for an improved system foraccurately determining the amount of electrical current flowing througha Hall effect current sensor. In particular, Hall effect current sensorstypically report a value of current that is offset from a true zerovalue when no current is flowing. In addition, this offset adds orsubtracts, depending on polarity, from the actual magnitude of theelectrical current reported when electrical current is flowing throughthe Hall effect current sensor.

The current sensor offset value of a Hall effect current sensor has twocomponents. The first component is a relatively constant electricaloffset that is an artifact of the manufacture of the sensor and themounting of the sensor on the circuit board. The second component is amagnetic offset that is an artifact of the previous history of flowingelectrical current. It changes with every change in electrical currentpolarity and magnitude.

The inventor has recognized that a Hall effect current sensor's offset,when determined solely by identifying the apparent electrical currentmagnitude at system startup, when electrical current is known to bezero, and subtracting that offset value from the value indicated by theHall effect current sensor, is not sufficient to accurately determinethe true magnitude of electrical current flowing through the sensor.This is due to the fact that such a value typically includes a valuerepresenting the sensor's electrical offset added to a valuerepresenting that sensor's magnetic offset. The improved system removesthe magnetic offset component by smoothing the successive values of theapparent electrical current magnitude over a history of apparent currentmagnitude values all taken at system startup when no electrical currentis flowing through the Hall effect current sensor.

Referring to FIG. 2, a flux density versus magnetizing force curve 200is illustrated. By empirical evidence, the balanced polarity nature ofthe magnetic offset (as shown by this symmetric-about-zero relationshipbetween magnetizing force and flux density), and reasoning about theuse/application of the Hall effect sensor, an assumption is made thatthe act of smoothing over a history of offset determinations will resultin the magnetic component values balancing out to near zero. Therefore,the remaining smoothed offset can be considered to be the true constantelectrical offset of the Hall effect current sensor.

SUMMARY

A system for accurately determining the amount of electrical currentflowing through a Hall effect current sensor is provided. The systemincludes a microcontroller operably coupled to the Hall effect currentsensor. The microcontroller determines an average measured apparentelectrical current value based on an electrical current output signalfrom the Hall effect current sensor during a vehicle startup time beforean electrical current is flowing through the sensor. The microcontrollerdetermines a smoothed electrical current offset value based on theaveraged set of measured apparent electrical current values, anelectrical current offset smoothing coefficient, a prior smoothedelectrical current offset value, and a prior electrical current offsettrend value. The microcontroller determines an electrical current offsettrend value associated with the Hall effect current sensor based on thesmoothed electrical current offset value, an electrical current offsettrend smoothing coefficient, a prior smoothed electrical current offsetvalue, and the prior electrical current offset trend value.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a schematic of a vehicle having a system for accuratelydetermining an amount of electrical current flowing through a Halleffect current sensor in accordance with an exemplary embodiment;

FIG. 2 is a schematic of a flux density versus magnetizing force curve;

FIG. 3 is a plot of forty-two consecutive averaged startup raw currentsensor values (trace 240) when contactors are open and current isexpected to be zero and also plot of the smoothed result of these rawvalues (trace 242) over the history of the preceding raw values up tothat point;

FIGS. 4-5 are flowcharts of a method for accurately determining anamount of electrical current flowing through the Hall effect currentsensor utilizing the system of FIG. 1.

DETAILED DESCRIPTION

Referring to FIG. 1, a vehicle 10 is provided. The vehicle 10 includes abattery pack 20, a Hall effect current sensor 22, a contactor 24, avoltage driver 26, a voltage driver 28, a vehicle load 34, an ignitionswitch 38, a system 40 in accordance with an exemplary embodiment, andelectrical lines 42, 44, 46, 47, 50, 52, 54, 56, 58, 59.

Referring to FIG. 3, a plot of raw electrical current sensor values(trace 240) and calculated smoothed electrical current offset values(trace 242) are illustrated. An advantage of the system 40 is that thesystem accurately determines an amount of electrical current flowingthrough the Hall effect current sensor 22 by correctly identifying theexpected constant value of electrical current offset by removing thealways varying magnetic current offset component from the value ofcurrent indicated by the Hall effect current sensor 22 during vehiclestartup when a contactor 24 has an open operational state and no currentis flowing. The system 40 implements this methodology by smoothing thenew values of current sensor output at each vehicle startup over ahistory of current sensor outputs all taken at vehicle startup when noelectrical current is flowing through the Hall effect current sensor 22.These characteristics can be seen in the following plots from realcollected data. The trace 240 shows forty-two individual current sensorvalues provided by the Hall effect current sensor 22 at vehicle startupwhen the contactor 24 has the open operational state and there is nocurrent flowing through the sensor 22. The values range fromapproximately −0.03 amps to −0.27 amps. Each of these 42 values arecomprised of a non-changing electrical offset component and an alwayschanging magnetic offset component. The trace 242 shows the result ofsmoothing of the individual values and represents the best estimate ofthe value of the electrical current offset.

For purposes of understanding, a few terms utilized herein will beexplained.

The term “node” is a region or a location in an electrical circuit.

The terms “voltage value” means a value that is equal to the magnitudeof a voltage.

The term “open operational state” means a state in which an electricalcurrent does not flow therethrough.

The term “A/D converter” means an analog-to-digital voltage converter.

The battery pack 20 includes a positive terminal 60 and a negativeterminal 62. In an exemplary embodiment, the battery pack 20 providessubstantially 48 Vdc between the positive terminal 60 and the negativeterminal 62. The positive terminal 60 is electrically coupled to aterminal 70 of the Hall effect current sensor 22 utilizing theelectrical line 42. The negative terminal 62 is electrically coupled toelectrical ground.

The Hall effect current sensor 22 is provided to measure an electricalcurrent flowing from the battery pack 20 to the vehicle load 34 when thecontactor 24 has a closed operational state. The Hall effect currentsensor 22 includes terminals 70, 72, 74. As discussed above, theterminal 70 is electrically coupled to the terminal 60 of the batterypack 20 utilizing the electrical line 42. The terminal 72 iselectrically coupled to the node 94 of the contactor 24 utilizing theelectrical line 44. Further, the terminal 76 is electrically coupled tothe A/D converter 142 utilizing the electrical line 59. The Hall effectcurrent sensor 22 measures an electrical current flowing between theterminals 70, 72 and outputs an electrical voltage output signal(indicative of the magnitude of the electrical current flowing throughthe sensor) from the terminal 74 that is received by the A/D converter142. The A/D converter 142 converts the measured electrical voltagevalues, which are proportional to the magnitude of the current flowingthrough the Hall effect sensor 22, in analog form from 0 to an exemplary5 volts into a digital representation of the voltage that is then readby the microcontroller 130. The digital representation of the 0 to 5volt voltage range is mapped across the number of bits of digitalrepresentation provided by the A/D converter 142. In an exemplaryembodiment the number of bits of digital representation is 12, allowingfor a range of values from 0 through 4095. The microprocessor 140 thenmaps these values to the range of actual current values of currentflowing through the Hall effect sensor 22. In an exemplary embodiment, arange of current values from −60 Amps to +60 Amps is mapped to 0representing −60 Amps 4095 representing +60 Amps and each value between0 and 4095 representing an increment of 4096/120 greater than theprevious value.

The contactor 24 has a contact 90, a contactor coil 92, a node 94, and anode 96. As discussed above, the node 94 is electrically coupled to theterminal 72 of the Hall effect current sensor 22 utilizing theelectrical line 44. Further, the node 96 is electrically coupled to thevehicle load 34 utilizing electrical line 46. The vehicle load 34 isfurther electrically coupled to the electrical ground utilizing theelectrical line 47.

When the microcontroller 130 commands the digital Input/Output device144 to generate first and second control signals that are received bythe voltage drivers 26, 28, respectively, the contactor coil 92 isenergized which transitions the contact 90 to a closed operationalstate. Alternately, when the microcontroller 130 commands the digitalI/O device 144 to generate third and fourth control signals that arereceived by the voltage driver 26 and the voltage driver 28,respectively, the contactor coil 92 is de-energized which transitionsthe contact 90 to an open operational state. In an exemplary embodiment,the third and fourth control signals can each be a ground voltage level.

The voltage driver 26 and the voltage driver 28 are provided to energizeor de-energize the contactor coil 92. The voltage driver 26 iselectrically coupled to the digital Input/Output device 144 of themicrocontroller 130 utilizing the electrical line 52. The voltage driver26 is further electrically coupled to a first end of the contactor coil92 utilizing the electrical line 54. The voltage driver 26 energizes thecontactor coil 92, when the voltage driver 26 receives a control signalfrom the microcontroller 130.

The voltage driver 28 is electrically coupled to the digitalInput/Output device 144 of the microcontroller 130 utilizing theelectrical line 56. The voltage driver 28 is further electricallycoupled to a second end of the contactor coil 92 utilizing theelectrical line 58. The voltage driver 28 is configured to conduct anelectrical current through to the electrical ground for energizing thecontactor coil 92, when the voltage driver 28 receives a control signalfrom the microcontroller 130.

The vehicle load 34 is electrically coupled to the node 96 of thecontactor 24. When the contactor 24 has a closed operational state, apositive voltage from the battery pack 20 is applied to the vehicle load34 for energizing the vehicle load 34. When the contactor 24 has an openoperational state, the positive voltage from the battery pack 20 isremoved from the vehicle load 34 which de-energizes the vehicle load 34.

The ignition switch 38 is electrically coupled to the microcontroller130 utilizing the electrical line 50. The ignition switch 38 has eithera closed operational state or an open operational state.

The system 40 is provided to accurately determine the amount ofelectrical current flowing through the Hall effect current sensor 22 inaccordance with an exemplary embodiment. The system 40 includes themicrocontroller 130 having the microprocessor 140, the A/D converter142, the digital Input/Output device 144, and a persistent memory device146. The microprocessor 140 is operably coupled to the A/D converter142, the digital Input/Output device 144, the flash memory device 148,and the persistent memory device 146. The persistent memory device 146stores data values utilized by the microprocessor 140 and the flashmemory device 148 stores the software application utilized by themicroprocessor.

The digital Input/Output device 144 is electrically coupled to thevoltage drivers 26, 28. The digital Input/Output device 144 outputscontrol signals that are received by the voltage drivers 26, 28 forcontrolling an operational state of the contactor 24.

The A/D converter 142 is electrically coupled to the terminal 74 of theHall effect current sensor 22 utilizing the electrical line 59. The A/Dconverter 142 converts an analog voltage value received from the Halleffect current sensor 22 that represents the magnitude of the currentflowing through the sensor and converts it to a digital representationthat is received by the microprocessor 140.

The persistent memory device 130 is provided to permanently store valuesfrom one power on cycle to the next, including the results of thesmoothing algorithm performed by the microprocessor 140 which needs tobe available as an input to the same smoothing algorithm during the nextapplication of the smoothing algorithm at the start of the next power oncycle.

Referring to FIGS. 1 and 4-5, a flowchart of a method for accuratelydetermining an amount of electrical current flowing through the Halleffect current sensor 22 utilizing the system 40 will now be explained.

At step 300, the ignition switch 38 is closed. After step 300, themethod advances to step 302.

At step 302, the microcontroller 130 initializes the followingvariables:

sum_of_electrical_current_samples=0;

count_of_electrical_current_samples=0. After step 302, the methodadvances to step 304.

At step 304, the microcontroller 130 iteratively performs the steps 306,308 while the contactor 24 has an open operational state such thatelectrical current is not flowing through a Hall effect current sensor22. If the value of step 304 equals “yes” (indicating the contactor 24has the open operational state), the microcontroller 130 performs thesteps 306, 308. Otherwise, the method advances to step 310.

At step 306, the microcontroller 130 samples a current output signalfrom the Hall effect current sensor 22 to obtain a latest measuredapparent electrical current value(latest_measured_apparent_electrical_current_value). After step 306, themethod advances to step 308.

At step 308, the microcontroller 130 updates the following variables:

sum_of_electrical_current_samples=sum_of_electrical_current_samples+latest_measured_apparent_electrical_current_value;

count_of_electrical_current_samples=count_of_electrical_current_samples+1.After step 308, the method returns to step 304.

Referring again to step 304, if the value of step 304 equals “no”, themethod advances to step 310.

At step 310, the microcontroller 130 determines an average measuredapparent electrical current value(average_electrical_current_value_during_this_startup) utilizing afollowing equation:average_electrical_current_value_during_this_startup=sum_of_electrical_current_samples/count_of_electrical_current_samples.After step 310, the method advances to step 320.

At step 320, the microcontroller 130 determines a smoothed electricalcurrent offset value (smoothed_electrical_current_offset_value)utilizing a following equation:smoothed_electrical_current_offset_value=(electrical_current_offset_smoothing_coefficient*average_electrical_current_value_during_this_startup)+((1+electrical_current_offset_smoothing_coefficient)*(prior_smoothed_electrical_current_offset_value+prior_electrical_current_offset_trend_value).After step 320, the method advances to step 322.

At step 322, the microcontroller 130 determines an electrical currentoffset trend value (electrical_current_offset_trend_value) utilizing afollowing equation:electrical_current_offset_trend_value=(electrical_current_offset_trend_smoothing_coefficient*(smoothed_electrical_current_offset_value−prior_smoothed_electrical_current_offset_value))+((1−electrical_current_offset_trend_smoothing_coefficient)*prior_electrical_current_offset_trend_value).The electrical_current_offset_smoothing_coefficient has a value in arange of 0-1. Also, theelectrical_current_offset_trend_smoothing_coefficient has a value in arange of 0-1. After step 322, the method advances to step 324.

At step 324, the microcontroller 130 iteratively performs the steps 326,340 while the ignition switch 38 is closed.

At step 326, the microcontroller 130 samples the electrical currentoutput signal from the Hall effect current sensor 22 to determine anupdated measured apparent electrical current value(updated_measured_apparent_electrical_current_value). After step 326,the method advances to step 340.

At step 340, the microcontroller 130 determines an accurate measuredelectrical current value (accurate_measured_electrical_current_value)utilizing the following equation:accurate_measured_electrical_current_value=updated_measured_apparent_electrical_current_value−smoothed_electrical_current_offset_value.After step 340, the method returns to the step 324.

The system described herein provides a substantial advantage over othersystems. In particular, the system described herein accuratelydetermines an amount of electrical current flowing through the Halleffect current sensor by removing the magnetic offset bias componentfrom the electrical current offset value by smoothing the successivestartup values of the current sensor value that is available at startupbefore the contactors are closed and current is flowing over a historyof startup current sensor values all taken when no electrical current isflowing through the Hall effect current sensor.

While the claimed invention has been described in detail in connectionwith only a limited number of embodiments, it should be readilyunderstood that the invention is not limited to such disclosedembodiments. Rather, the claimed invention can be modified toincorporate any number of variations, alterations, substitutions orequivalent arrangements not heretofore described, but which arecommensurate with the spirit and scope of the invention. Additionally,while various embodiments of the claimed invention have been described,it is to be understood that aspects of the invention may include onlysome of the described embodiments. Accordingly, the claimed invention isnot to be seen as limited by the foregoing description.

What is claimed is:
 1. A system for accurately determining an amount ofelectrical current flowing through a Hall effect current sensor,comprising: the Hall effect current sensor electrically coupled inseries with a battery pack and a contactor, the Hall effect currentsensor generating an electrical current output signal; an electricalline electrically coupled to and between the Hall effect current sensorand a microcontroller; the microcontroller receiving the electricalcurrent output signal from the Hall effect current sensor utilizing theelectrical line, the microcontroller determining an average measuredapparent electrical current value based on the electrical current outputsignal from the Hall effect current sensor, before an electrical currentis flowing through the Hall effect current sensor; the microcontrollerdetermining a smoothed electrical current offset value based on theaverage measured apparent electrical current value, an electricalcurrent offset smoothing coefficient, a prior smoothed electricalcurrent offset value, and a prior electrical current offset trend value;and the microcontroller determining an electrical current offset trendvalue associated with the Hall effect current sensor based on thesmoothed electrical current offset value, an electrical current offsettrend smoothing coefficient, a prior smoothed electrical current offsetvalue, and the prior electrical current offset trend value.
 2. Thesystem of claim 1, wherein: the microcontroller determining an updatedmeasured apparent electrical current value based on the electricalcurrent output signal from the Hall effect current sensor, when theelectrical current is flowing through the Hall effect current sensor;and the microcontroller determining an accurate measured electricalcurrent value by subtracting the smoothed electrical current offsetvalue from the updated measured apparent electrical current value. 3.The system of claim 1, wherein: the microcontroller sampling theelectrical current output signal from the Hall effect current sensorwhile a contactor has an open operational state to obtain a plurality ofmeasured apparent electrical current values and before the electricalcurrent is flowing through the Hall effect current sensor; and themicrocontroller determining the average measured apparent electricalcurrent value based on the plurality of measured apparent electricalcurrent values.
 4. The system of claim 1, wherein the smoothedelectrical current offset value is calculated utilizing a followingequation:smoothed electrical current offset value=(electrical current offsetsmoothing coefficient*average measured apparent electrical currentvalue)+((1−electrical current offset smoothing coefficient)*(priorsmoothed electrical current offset value+prior electrical current offsettrend value).
 5. The system of claim 1, wherein the electrical currentoffset trend value is calculated utilizing a following equation:electrical current offset trend value=(electrical current offset trendsmoothing coefficient*(smoothed electrical current offset value−priorsmoothed electrical current offset value))+((1−electrical current offsettrend smoothing coefficient)*prior electrical current offset trendvalue).
 6. The system of claim 1, wherein the electrical current offsetsmoothing coefficient has a value in a range of 0-1.
 7. The system ofclaim 1, wherein the electrical current offset trend smoothingcoefficient has a value in a range of 0-1.